package com.apobates.jforum2.troll.accounts.mapper;

import com.apobates.jforum2.troll.accounts.MemberProfileBean;
import com.apobates.jforum2.troll.accounts.stub.vo.MemberProfileVo;
import com.apobates.jforum2.troll.utils.core.api.OptionalEntityTransformMapper;
import java.util.Optional;

/**
 *
 * @author xiaofanku
 */
public class MemberProfileVoMapperEntity implements OptionalEntityTransformMapper<MemberProfileBean,MemberProfileVo>{
    @Override
    public Optional<MemberProfileVo> transform(Optional<MemberProfileBean> entity) {
        return entity.map(mpb->{
            MemberProfileVo mpv = new MemberProfileVo();
            mpv.setId(mpb.getId());
            mpv.setNickname(mpb.getNickname());
            mpv.setGroupName(mpb.getGroupName());
            mpv.setRoleName(mpb.getRoleName());
            mpv.setStyle(mpb.getStyle());
            mpv.setAvatar(mpb.getEncodeAvatarPath());
            mpv.setSignature(mpb.getSignature());
            mpv.setThreads(mpb.getThreads());
            mpv.setReplies(mpb.getReplies());
            mpv.setLevel(mpb.getLevel());
            mpv.setLevelNo(mpb.getLevelNo());
            mpv.setScore(mpb.getScore());
            return mpv;
        });
    }
}